<order-item>
    <div class="order-wrapper">
        <div class="order-item">
            <p>
                <span>订单号： { data.ego_orderid }</span>
                <span class="{ statusClass }">{ getOrderStatus(data.status) }</span>
            </p>
            <p>
                <span>目的地： { data.receiver_country }</span>
                <span class="red-color" if="{ this.extract }">提成： { filterProfit(data.extract) }</span>
            </p>
            <p>
                <span>重量： { data.final_weight || 0 }KG</span>
            </p>
            <p class="time">
                <span>{ data.create_time }</span>
            </p>
            <button>查询详情</button>
        </div>
        <p class="fill-order">
            <span>快速回填国内单号</span>
        </p>

    </div>

    <script>
        this.data = opts.data
        getOrderStatus (status) {
            switch (status) {
                case 1:
                    return '待寄件'
                case 2:
                    return '待支付'
                case 3:
                    return '运输中'
            }
        }

        filterProfit (profit) {
            return profit ? '￥' + profit : ''
        }

        this.statusClass = {
            'red-color': this.data.status === 2
        }
    </script>

    <style>
        .red-color {
            color: #ed495e;
        }
        .order-wrapper {
            margin: 0;
        }
        .order-wrapper > p {
            margin: 20px 0 0 0;
            text-align: right;
        }
        .order-item {
            position: relative;
            padding: 20px 15px;
            border-radius: 8px;
            background: #fff;
            box-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
            font-size: 14px;
        }
        .order-item .time {
            color: #999;
        }
        .order-item button {
            position: absolute;
            bottom: 20px;
            right: 20px;
            border: none;
            border-radius: 4px;
            background: #6daffc;
            color: #fff;
            font-size: 14px;
            padding: 5px 12px;
        }
        .order-item p {
            display: flex;
            flex-direction: row;
            justify-content: space-between;
        }
        .order-item p:nth-of-type(n+2) {
            margin: 10px 0 0 0;
        }
        .fill-order {
            color: #6a86fe;
            font-size: 14px;
        }
    </style>
</order-item>